const mongoose = require("mongoose")

const ObjectId = mongoose.Schema.Types.ObjectId;
//宠主模板
const HostSchema = new mongoose.Schema({
    nickname: String, // 昵称
    mobile: String,//电话号码
    name: String,//真实姓名
    vipCard: [{
        shop: { //关联的门店
            type: ObjectId,
            ref: "Shop"
        },
        integral: Number, //积分
    }], //会员卡
    avatar: String,//头图
    address: [
        {name:String,//收获人地址
        phone:String,//收获人电话号码
        address:String//收获人地址
        }
    ],//送货地址
    area: String,//区域
    score: Number,//个人积分（签到，消费，等加分
    pets: [{
        name: String,//宠物名
        species: String,//  品类：狗、猫
        breed: String,//种类：泰迪、比熊等
        color: String,//颜色：
        birthday: String,//出生日期：年月即可
        character: String, //性格：温驯、狂野、攻击性
    }],
    order: [{
        type: ObjectId,
        ref: "Order"
    }]
}, {

        versionKey: false,
        timestamps: {
            createdAt: 'createTime',
            updatedAt: 'updateTime'
        } //自动管理修改时间
    })

module.exports = mongoose.model("Host", HostSchema);